<template>
  <view>
    <uv-calendar ref="calendar" mode="range" showLunar></uv-calendar>
    <button @click="open">打开</button>
  </view>
</template>
<script>
export default {
  onReady() {
    this.$refs.calendar.setFormatter(this.formatter);
  },
  methods: {
    open() {
      this.$refs.calendar.open();
    },
    confirm(e) {
      console.log("日历选择：", e);
    },
    formatter(day) {
      const d = new Date();
      let month = d.getMonth() + 1;
      const date = d.getDate();
      if (day.month == month && day.day == date + 3) {
        day.bottomInfo = "打8折";
        day.dot = true;
        day.disabled = true;
        console.log(day);
      }
      return day;
    },
  },
};
</script>
